// pages/place/quan/quan.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {

	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		let listData = JSON.parse(options.data)
		this.setData({
			list: listData,
			xb: options.xb,
			chang: options.chang
		})
		console.log(listData)

	},
	draw(e) {
		console.log(e)
		this.setData({
			xz: e.currentTarget.dataset.index,
			id: e.currentTarget.dataset.id,
		})
	},
	sure() {
		let pages = getCurrentPages(); // 当前页的数据，可以输出来看看有什么东西
		let prevPage = pages[pages.length - 2];
		console.log(this.data.chang)
		let a = this.data.list[this.data.xz].qname + ' ' + this.data.list[this.data.xz].price
		let cac = ''
		if (this.data.chang != undefined) {
			cac = this.data.chang.split(',')
			cac[this.data.xb] = a
		} else {
			cac = a
		}
		prevPage.setData({
			qian: this.data.list[this.data.xz].price,
			txt: cac,
			qid: this.data.id
		})
		wx.navigateBack({
			delta: 1
		})
	}
})
